package com.saxing.testflux.action.base;

import com.saxing.testflux.dispatcher.Dispatcher;

/**
 * Created by saxing on 17-7-9.
 */

public class ActionsCreator {

    private static ActionsCreator instance;
    final Dispatcher dispatcher;

    public Dispatcher getDispatcher() {
        return dispatcher;
    }

    public ActionsCreator(Dispatcher dispatcher) {
        this.dispatcher = dispatcher;
    }

    public static ActionsCreator get(Dispatcher dispatcher){
        if (instance == null){
            instance = new ActionsCreator(dispatcher);
        }
        return instance;
    }

    public void sendMessage(Action action){
        dispatcher.dispatch(action);
    }
}

